package com.cn.mapper.dao.db5.ComponentMechanical;

import com.cn.bean.pojo.ComponentMechanical.RepairApplicationMain;
import com.cn.bean.pojo.ComponentMechanical.RepairApplicationSub;
import com.cn.bean.pojo.ComponentMechanical.RepairOutsourcingMainTable;
import com.cn.bean.pojo.ComponentMechanical.RepairOutsourcingSubTable;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
@Mapper
public interface RepairApplicationDao {
    List<RepairApplicationSub> selectRepairApplicationMain(@Param("page")int page, @Param("limit")int limit, @Param("equipmentName")String equipmentName, @Param("uniqueCode")String uniqueCode);
    //异常返修申请页面
    List<RepairApplicationMain> selectRepairApplicationMainAll(@Param("page")int page,@Param("limit")int limit,@Param("code")String code);
    List<RepairApplicationSub>selectRepairSubTable(RepairApplicationSub repairApplicationSub);
    List<RepairOutsourcingSubTable>selectRepairOutsourcingSub(int id);
    Boolean insertRepairOutsourcingMainTable(RepairOutsourcingMainTable repairOutsourcingMainTable);
    Boolean insertRepairOutsourcingSubTable(RepairOutsourcingSubTable repairOutsourcingSubTable);
    Boolean openRepairOutsourcing(String uniqueCode);
    Boolean updateReturn(RepairApplicationMain repairApplicationMain);
    Boolean updateApplicationAudit(int id);
    Boolean updateRepairOutsourcingAudit(int id);
    Boolean delRepairOutsourcingSubTable(int id);
    Boolean updateReturnSub(RepairApplicationSub repairApplicationSub );
    Boolean completeRepairOutsourcing(String uniqueCode);
    Integer getRepairOutsourcingSubAutoid();
    List<RepairApplicationMain> selectRepairOutsourcingAll(@Param("page")int page,@Param("limit")int limit,@Param("code")String code);
    int addRepairApplicationMain(@Param("repairApplicationMain")RepairApplicationMain repairApplicationMain);
    int addRepairApplicationSub(@Param("repairApplicationSub")RepairApplicationSub repairApplicationSub);
    //修改主表状态
    int deleteRepairApplicationMain(@Param("id")int id);
    //删除子表（修改）
    int deleteRepairApplicationSub(@Param("id")int id);

    //回显数据
    List<RepairApplicationMain> selectEchoRepairApplicationMainAll(@Param("id")int id);
    List<RepairApplicationSub>selectEchoRepairSubTable(@Param("id")int id);

    int updateRepairApplicationMain(@Param("repairApplicationMain")RepairApplicationMain repairApplicationMain);
    //审核
    //1:主表变为已审核
    //如果为自磨。单件状态（1）完成：物料状态为0（待登记）；流转状态为1（待耗用）
    //                （2）报废：物料状态为5（报废）；流转状态为4（异常）
    //委外：物料状态为4，流转状态为4
    int updateRepairApplicationMainAuto(@Param("id")int id,@Param("reviewer")String reviewer,@Param("reviewerID")String reviewerID,@Param("reviewTime")String reviewTime);
    //修改单间状态

    int updateComponentSingleRegistrationAuto(@Param("materialStatus")int materialStatus,@Param("circulationState")int circulationState,@Param("uniqueCode")String uniqueCode,@Param("lock")int lock);


}
